/*************************************************************************
	> File Name: P1234.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2025-04-09 10:20:43
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

int m, n, ans = 0;
int dir[4][2] = {
    {-1, 0}, {1, 0}, {0, -1}, {0, 1}
};

int search(vector<string> &s, int x, int y) {
    int res = 0;
    for (int k = 0; k < 4; k++) {
        string str = "";
        for (int step = 0; step <  4; step++) {
            int dx = x + dir[k][0] * step;
            int dy = y + dir[k][1] * step;
            if (dx < 0 || dx >= m || dy < 0 || dy >= n) break;
            str.push_back(s[dx][dy]);
        }
        res += (str == "hehe");
    }
    return res;
}

void dfs(vector<string> &s, int x, int y) {
    for (int i = x; i < m; i++) {
        for (int j = y; j < n; j++) {
            ans += search(s, i, j);
        }
    }
    return ;
}

int main() {
    cin >> m >> n;
    vector<string> arr(m);
    for (int i = 0; i < m; i++) {
        cin >> arr[i];
    }
    dfs(arr, 0, 0);
    cout << ans << endl;
    return 0;
}
